<template>
    <div style="max-width: 95%!important;margin: 0 auto">
        <Alert show-icon>
            <div class="flrc">
                <div class="flex1"><h5>菜单管理</h5></div>
                <div>
                    <div class="padr10" slot="">
                        <Button shape="circle" type="success" to="/admin/m/MMM/edit">
                            <Icon left type="md-add"></Icon>
                            新增
                        </Button>
                    </div>
                </div>
            </div>
            <Icon type="ios-bulb-outline" slot="icon" size="30"></Icon>
            <div class="flrc" slot="desc">
                <div class="flrc lh2 padr9"><Icon size="24" type="md-add"></Icon>展开</div>
                <div class="flrc lh2 padlr9"><Icon size="24" type="md-remove"></Icon>折叠</div>
                <div class="flrc lh2 padlr9"><Icon size="24" type="md-close"></Icon>删除一项</div>
                <div class="flrc lh2 padlr9"><Icon size="20" type="md-copy"></Icon>复制一项</div>
                <div class="flrc lh2 padlr9"><Icon size="20" type="md-create"></Icon>编辑修改</div>
                <div class="flex1">&nbsp;</div>
            </div>
        </Alert>
        <Card :z-depth="7" class="pad10 flex-c flex-start mart10" style="min-height: 50vh;">
            <Alert show-icon>
                <Icon size="16" type="md-move"></Icon>
                <span>拖动项目,以进行列表内排序</span></Alert>
            <div class="mart10" v-if="lists.length > 0">
                <EzCategory class="padlr bc13" entityName="MMM" :lists="lists" :expand="true"
                            @change="getList"></EzCategory>
            </div>

        </Card>
    </div>
</template>
<script>
    import EzCategory from "../../../../ez/list/EzCategory";

    export default {
        components: {EzCategory},
        name: 'Category_auto___DIR____EN_NAME__',
        data() {
            return {
                onload: true,
                entityName: '',
                title: '-',
                where_: {"parent__isnull": true},
                order_: ["sort"],
                loading: true,
                lists: [],
            }
        },
        methods: {
            getList() {
                let _this = this
                _this.loading = true
                // 处理条件筛选
                let url = '/ez/admin/MMM/category'
                this.$http.post(url, {
                    _where: _this.where_,
                    _order: _this.order_,
                    _depth: 5
                }, function (res) {
                    _this.loading = false
                    _this.lists = res.data.lists
                })
            }
        },
        created() {
            this.entityName = this.$route.query.en

        },
        mounted() {
            this.getList()
        },
        watch: {
            '$route'(to) {
                this.entityName = to.query.en
                this.where_ = undefined
                this.showSearch = false
            },
            entityName() {

            },
            where_() {
            }
        }
    }
</script>

<style scoped>

</style>
